#include "login.h"
#include "ui_login.h"
#include "mainwindow.h"

login::login(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::login)
{
    ui->setupUi(this);
}

login::~login()
{
    delete ui;
}


void login::on_pushButton_clicked()
{
    QString name = ui->username->text();
    QString passwd = ui->password->text();
    if(name == "gec" && passwd == "123456")
    {
        MainWindow *mainwin= new MainWindow(this);
        mainwin->show();
        mainwin->getmsg(name);
        this->hide();//hide()==>隐藏，close()==>关闭
    }
}


void login::on_password_editingFinished()
{
    on_pushButton_clicked();
}


void login::on_username_editingFinished()
{
    on_pushButton_clicked();
}

